package it.units.dacuts.image;

/**
 * Image represented by pixels with RGB values. The alpha channel is present for
 * compatibility with the ARGB color model and its value is always set to {@code 0xFF}
 * (full opacity).
 */
public interface Image {

    /**
     * Returns the image's width in pixels.
     *
     * @return the image's width in pixels
     */
    int getWidth();

    /**
     * Returns the image's height in pixels.
     *
     * @return the image's height in pixels
     */
    int getHeight();

    /**
     * Returns the ARGB value of the pixel at coordinates {@code x} and
     * {@code y}.
     *
     * @param x the pixel's coordinate over the x axis of the image
     * @param y the pixel's coordinate over the y axis of the image
     * @return the ARGB value of the pixel
     * @throws IndexOutOfBoundsException if given coordinates are out of the
     * image boundaries
     */
    int getPixelRGBValue(int x, int y);

    /**
     * Returns the red value of the pixel at coordinates {@code x} and
     * {@code y}. Its value has one byte size, but it is returned as an {@code int}
     * because the Java type {@code byte} is signed.
     *
     * @param x the pixel's coordinate over the x axis of the image
     * @param y the pixel's coordinate over the y axis of the image
     * @return the red value of the pixel
     * @throws IndexOutOfBoundsException if given coordinates are out of the
     * image boundaries
     */
    int getPixelRedValue(int x, int y);

    /**
     * Returns the green value of the pixel at coordinates {@code x} and
     * {@code y}. Its value has one byte size, but it is returned as an {@code int}
     * because the Java type {@code byte} is signed.
     *
     * @param x the pixel's coordinate over the x axis of the image
     * @param y the pixel's coordinate over the y axis of the image
     * @return the green value of the pixel
     * @throws IndexOutOfBoundsException if given coordinates are out of the
     * image boundaries
     */
    int getPixelGreenValue(int x, int y);

    /**
     * Returns the blue value of the pixel at coordinates {@code x} and
     * {@code y}. Its value has one byte size, but it is returned as an {@code int}
     * because the Java type {@code byte} is signed.
     *
     * @param x the pixel's coordinate over the x axis of the image
     * @param y the pixel's coordinate over the y axis of the image
     * @return the blue value of the pixel
     * @throws IndexOutOfBoundsException if given coordinates are out of the
     * image boundaries
     */
    int getPixelBlueValue(int x, int y);
}
